cmake_minimum_required(VERSION 2.8)

include(FindFFMPEG)

#######################
#Build vus_test library
#######################
set(VUS_TEST_SOURCES
	src/vus_test_frame.c
	src/vus_test_video_ffmpeg.c)

set(VUS_TEST_HEADERS
	include/vus_test.h
	include/vus_test_frame.h
	include/vus_test_private_includes.h
	include/vus_test_public_includes.h
	include/vus_test_video_ffmpeg.h)

if(MSVC)
	include_directories(include ${FFMPEG_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/extern/msinttypes)
else(MSVC)
	include_directories(include ${FFMPEG_INCLUDE_DIRS})
endif(MSVC)

add_definitions(-DVUS_TEST_COMPILE_LIB)
add_library(vus_test SHARED ${VUS_TEST_SOURCES} ${VUS_TEST_HEADERS})

set_target_properties(vus_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${VENTUS_RUNTIME_OUTPUT}")
set_target_properties(vus_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${VENTUS_LIBRARY_OUTPUT}")
set_target_properties(vus_test PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${VENTUS_ARCHIVE_OUTPUT}")
target_link_libraries(vus_test ${FFMPEG_LIBRARIES} ${FFMPEG_LIBSWSCALE_LIBRARIES} )

###################
#Configure tests
###################
function(VUS_CONFIG_TEST test_name)
	include_directories({VUS_TEST_SOURCE_DIR}/include ${FFMPEG_INCLUDE_DIRS} ${MSINTTYPES_INCLUDE_DIR})
	message(${test_name})
	set_target_properties(${test_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${VENTUS_RUNTIME_OUTPUT}")
	add_dependencies(${test_name} vus_test)
	target_link_libraries(${test_name} vus_test)
endfunction(VUS_CONFIG_TEST)

########################
#Build tests
########################
add_subdirectory(open_video)
